﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    public partial class RegisterForm : Form
    {
        public RegisterForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var uid = UserName.Text;
            var pwd = PassWord.Text;
            var rePwd = RetryPassWord.Text;
            var sql = string.Format("insert into Users(Username,Password) values ( '{0}','{1}' );",UserName.Text,PassWord.Text);
            var res = DbHelper.AddOrUpdateOrDelect(sql);
            if (pwd == rePwd &&res>0)
            { 
               
                MessageBox.Show("注册成功");
                Form1 form1 = new Form1();
                this.Hide();
                form1.Show();
            }
            else
            {
                MessageBox.Show("注册失败");
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form1 form1 = new Form1();
            this.Hide();
            form1.Show();
        }
    }
}
